package com.jwthhealth_pub.wristband.view.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.jwthhealth_pub.R;

/**
 * Created by liuzhen on 2017/12/13.
 */

public class WristGuideBtn extends LinearLayout{

    private TextView text;
    private ImageView img;
    private Paint mCirclePaint;

    public WristGuideBtn(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);

        TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.JwthWristBandGuideBtn);

        String describeText = ta.getString(R.styleable.JwthWristBandGuideBtn_describe_text);
        float describeTextSize = ta.getDimension(R.styleable.JwthWristBandGuideBtn_describe_text_size, 20);
        int describeTextColor = ta.getColor(R.styleable.JwthWristBandGuideBtn_describe_text_color, context.getResources().getColor((R.color.textColorBlack)));
        Drawable describeImg = ta.getDrawable(R.styleable.JwthWristBandGuideBtn_describe_img);

        ta.recycle();

        text = new TextView(context);

        initPaint();
    }

    private void initPaint() {
        mCirclePaint = new Paint();
        mCirclePaint.setStrokeWidth(1);
        mCirclePaint.setAntiAlias(true);
    }

    @Override
    protected void onLayout(boolean b, int i, int i1, int i2, int i3) {
        text.layout(0,0,0,0);
        img.layout(100,100,100,100);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        int height = getHeight();
        int width = getWidth();

        int circle = height/4;

        canvas.drawCircle(width/2, height/2, circle, mCirclePaint);
    }
}
